﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace UrTransPayloadWpf
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        public App()
        {
            DispatcherUnhandledException += App_DispatcherUnhandledException;
            InitializeComponent();
        }

        private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            string message = string.Format("{0}\r\n操作发生错误，您需要退出系统么？", e.Exception.Message);
            MessageBoxResult pp =MessageBox.Show(message, "软件发生错误，建议联系管理员", MessageBoxButton.YesNo);
            e.Handled = true;
            if (pp == MessageBoxResult.Yes)
                Environment.Exit(0);
            else
                return;
        }
    }
}
